<extend name="Public/base" />

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>土货活动列表</h2>
    </div>
    <div class="cf">
        <div class="fl">
            <button class="btn ajax-post confirm" target-form="ids" url="{:U('Native/delete')}">删 除</button>
        </div>

        <!-- 高级搜索 -->
        <div class="search-form fr cf">
            <div class="sleft">
                <select name="status" id="status">
                    <option value="-1" <if condition="$status eq -1">selected</if>  style="width:200px">状态选择</option>
                    <option value="1" <if condition="$status eq 1">selected</if>  style="width:200px">开启</option>
                    <option value="2" <if condition="$status eq 2">selected</if>  style="width:200px">关闭</option>
                </select>
            </div>
			<div class="sleft">
                <select name="type" id="type">
                    <option value="-1" <if condition="$type eq -1">selected</if>  style="width:200px">方案选择</option>
					 <option value="2" <if condition="$type eq 2">selected</if>  style="width:200px">方案一</option>
                    <option value="1" <if condition="$type eq 1">selected</if>  style="width:200px">方案二</option>
                </select>
            </div>
            <div class="sleft">
                <input type="text" name="province" class="search-input" value="{:I('province')}" placeholder="省份">
            </div>
            <div class="sleft">
                <input type="text" name="city" class="search-input" value="{:I('city')}" placeholder="城市">
            </div>
            <div class="sleft">
                <input type="text" name="mobile" class="search-input" value="{:I('mobile')}" placeholder="手机号">
            </div>
            <div class="sleft">
                <input type="text" name="native_products" class="search-input" value="{:I('native_products')}" placeholder="土特产">
            </div>
            <div class="sleft">
                <input type="text" id="add_time" name="add_time"  class="search-input" value="{:I('add_time')}" placeholder="添加时间">
            </div>
            <div class="sleft">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a>
            </div>
        </div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
        <table class="">
            <thead>
            <tr>
                <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
                <th class="">编号</th>
                <th class="">UID</th>
                <th class="">用户昵称</th>
                <th class="">省</th>
                <th class="">市</th>
                <th class="">土特产品</th>
                <!--<th class="">积分</th>-->
                <th class="">图片</th>
                <th class="">手机号</th>
                <th class="">点赞次数</th>
                <th class="">状态</th>
                <th class="">添加时间</th>
                <th class="">操作</th>
            </tr>
            </thead>
            <tbody>
            <notempty name="list">
                <volist name="list" id="vo">
                    <tr>
                        <td><input class="ids" type="checkbox" name="ids[]" value="{$vo.id}" /></td>
                        <td>{$vo.id} </td>
                        <td>{$vo.user_id} </td>
                        <td>{$vo.nickname} </td>
                        <td>{$vo.province}</td>
                        <td>{$vo.city}</td>
                        <td>{$vo.native_products}</td>
                        <!--<td><img width="100" height="30" src="__ROOT__/{$vo.path}"></td>-->
                        <td><img width="100" height="30" src="{:get_cover($vo['cover_id'],'path')}"></td>
                        <td>{$vo.mobile}</td>
                        <td>{$vo.support_num}</td>
                        <td><if condition="$vo['status'] eq 1">开启<else />关闭</if></td>
                        <td>{$vo.add_time|date="Y-m-d H:i:s",###}</td>
                        <td>
                            <a href="{:U('native/click_like?activity_id='.$vo['id'])}">点赞用户列表</a>
                            <a href="{:U('native/delete?ids='.$vo['id'])}" class="confirm ajax-get">删除</a>
                        </td>
                    </tr>
                </volist>
                <else/>
                <td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
            </notempty>
            </tbody>
        </table>
    </div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js?v={:SITE_VERSION}"></script>
    <link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
    <php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
    <link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
    <script type="text/javascript">
        //搜索功能
        $("#search").click(function(){
            var url = $(this).attr('url');
            var query  = $('.search-form').find('input').serialize();
            var status=$('#status').val();
			var type=$('#type').val();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            query+="&status="+status;
			query+="&type="+type;
			
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }
            //alert(url);
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function(e){
            if(e.keyCode === 13){
                $("#search").click();
                return false;
            }
        });
        //导航高亮
        $('.side-sub-menu').find('a[href="{:U('Native/index')}"]').closest('li').addClass('current');
        $('#add_time').datetimepicker({
            format: 'yyyymmdd',
            language:"zh-CN",
            minView:2,
            autoclose:true
        });

    </script>
</block>
